//检查内存中的用户是否存在
exports.getUserInfo = function (session, uid) {
    return new Promise((resolve, reject) => {
        this.app.rpc.login.loginRemote.getUser(session, uid, function (err, userInfo) {
            if (err) return reject(err);
            resolve(userInfo);
        });
    });
}

//保存用户信息 内存中
exports.saveUserInfo = function (session, user) {
    return new Promise((resolve, reject) => {
        this.app.rpc.login.loginRemote.setUser(session, user, function (err, userInfo) {
            if (err) return reject(err);
            resolve(userInfo);
        });
    });
}

//增加用户的石油
exports.addUserOil = function (session, uid, oilNum, source,extend='') {
    return new Promise((resolve, reject) => {
        this.app.rpc.login.loginRemote.addOil(session, uid, session.frontendId, oilNum, source,extend, function (err) {
            if (err) return reject(err);
            resolve();
        });
    });
}

//增加用户的金币
exports.addUserConis = function (session, uid, coinsNum, push) {
    return new Promise((resolve, reject) => {
        this.app.rpc.login.loginRemote.addCoins(session, uid, session.frontendId, coinsNum, push, function (err) {
            if (err) return reject(err);
            resolve();
        });
    });
}

//增加徒弟贡献的石油
exports.apiAddUserApprenticeOil = function (session, uid, oilNum) {
    return new Promise((resolve, reject) => {
        this.app.rpc.login.loginRemote.addUserApprenticeOil(session, uid, oilNum, function (err) {
            if (err) return reject(err);
            resolve();
        });
    });
}

//增加徒孙贡献的石油
exports.apiAddUserDiscipleOil = function (session, uid, oilNum) {
    return new Promise((resolve, reject) => {
        this.app.rpc.login.loginRemote.addUserDiscipleOil(session, uid, oilNum, function (err) {
            if (err) return reject(err);
            resolve();
        });
    });
}